<template>
    <div class="cart-bar">
        <div class="s-btn" @click="selectAll">
            <span v-if="selected" class="iconfont iconxuanzhong"></span>
            <span v-else class="iconfont iconweixuanzhong"></span>
            <span>全选</span>
        </div>
        <div class="prices">
            <span class="dec">
                已优惠 <span class="price">{{desc}}</span> 元
            </span>
            <span class="total">
                合计: <span class="price">¥ {{total}}</span>
            </span>
        </div>
        <radius-btn @click.native="commit" style="font-size: 0.32rem" txt="去结算" class="buy-btn" width="2rem"
                    height="0.8rem"></radius-btn>
    </div>
</template>

<script>
    import radiusBtn from "@/components/base/radius-btn"

    export default {
        props: {
            desc: {

                default: 0
            },
            total: {

                default: 0
            },
            selected: null
        },
        data() {
            return {}
        },
        methods: {
            commit() {
                this.$emit('commit')
            },
            selectAll() {
                // this.selected = !this.selected
                this.$emit('selectAll')
            }
        },
        components: {
            radiusBtn
        }
    }
</script>

<style scoped lang="stylus">
    .cart-bar
        z-index 1
        position fixed
        left 0
        right 0
        bottom $bar-height
        height 44px
        padding 0 10px 0 18px
        display flex
        align-items center
        background-color white

        .s-btn
            height 100%
            flex 0 0 80px
            display flex
            align-items center
            justify-content flex-start
            color #A1A1A1
            font-size 11px

            .iconfont
                position relative
                margin-right 5px
                font-size 14px
                color #B1B1B1

        .prices
            flex 1
            display flex
            align-items center
            padding-right 10px
            justify-content flex-end
            .dec
                color #A1A1A1
                font-size 9px
                margin-right 5px

                .price
                    color #F6CE75

            .total
                font-size 12px
                color #4E3D07

                .price
                    color #F7895E

        .buy-btn
            flex 0 0 75px

</style>